

<title>修改密码</title>

<link rel="stylesheet" href="/statics/public/css/system/account.css">
<link rel="stylesheet" href="/statics/public/vendor/jquery-strength/jquery-strength.css">
<link rel="stylesheet" href="/statics/public/vendor/alertify-js/alertify.css">
<link rel="stylesheet" href="/statics/public/vendor/formvalidation/formValidation.css">
<div class="page animation-fade page-account">
    <div class="page-content">
        <div class="row">

            <div class="col-sm-6 col-sm-offset-3 margin-vertical-35">
                <form class="form-horizontal">
                    {% csrf_token %}
                    <div class="form-group">
                        <h5>修改密码</h5>
                    </div>
                    <div class="form-group">
                        <input type="password" name="new_password" class="form-control" placeholder="请输入新密码" autocomplete="off" data-plugin="strength">
                    </div>
                    <div class="hidden">
                        <input type="text">
                        <input type="text">
                        <input type="button">
                    </div>

                </form>
                <div class="form-group">
                        <button id="btn_submit" class="btn btn-primary">确认修改</button>
                    </div>
            </div>

        </div>
    </div>
</div>

<script>
    (function ($) {
        $("#btn_submit").on('click', function () {
            var csrfmiddlewaretoken = $('input[name="csrfmiddlewaretoken"]').val();
            var data = $(".form-horizontal").serialize() + "&csrfmiddlewaretoken=" + csrfmiddlewaretoken;
            var url = '{% url "password" %}';
            $.post(url, data, function (result) {
                if(!result['status']){
                    toastr['error'](result['message']);

                }else{
                    toastr['success'](result['message']);

                    setTimeout(function () {
                        location.href = '/';
                    }, 1000);

                }
            }, 'json')

        })
    })(jQuery)
</script>
